package com.itheima.health.job;

import com.itheima.health.dao.OrderSettingDao;
import com.itheima.health.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ClearOrderSettingJob {

    @Autowired
    private OrderSettingDao orderSettingDao;

    // 使用Quartz清理过期预约设置
    public void clearOrderSetting(){
        try {
            String today = DateUtils.parseDate2String(DateUtils.getToday());
            orderSettingDao.deletePastOrderSetting(today);
            System.out.println(DateUtils.parseDate2String(new Date())+"做了清除处理");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
